package com.eastfair.imaster.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 观众预登记信息状态表
 * </p>
 *
 * @author zjn
 * @date 2021-12-13
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "VisitorRegisterStateRegisterTypeEnum", description = "注册方式 #{imaster:注册预登记;team:团体预登记;abroad:海外预登记;bzt:B展通-枚举")
public enum VisitorRegisterStateRegisterTypeEnum implements BaseEnum {

    /**
     * IMASTER="注册预登记"
     */
    IMASTER("注册预登记"),
    /**
     * TEAM="团体预登记"
     */
    TEAM("团体预登记"),
    /**
     * ABROAD="海外预登记"
     */
    ABROAD("海外预登记"),
    /**
     * BZT="B展通"
     */
    BZT("B展通"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static VisitorRegisterStateRegisterTypeEnum match(String val, VisitorRegisterStateRegisterTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static VisitorRegisterStateRegisterTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(VisitorRegisterStateRegisterTypeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "IMASTER,TEAM,ABROAD,BZT", example = "IMASTER")
    public String getCode() {
        return this.name();
    }

}
